package com.hjm.project.ActActivityDistribution.ActActivityDistribution.service.impl;

import java.util.List;
import java.util.Map;

import com.hjm.common.utils.yh.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hjm.project.ActActivityDistribution.ActActivityDistribution.mapper.ActActivityDistributionMapper;
import com.hjm.project.ActActivityDistribution.ActActivityDistribution.domain.ActActivityDistribution;
import com.hjm.project.ActActivityDistribution.ActActivityDistribution.service.IActActivityDistributionService;
import com.hjm.common.utils.text.Convert;

/**
 * 活动分润对象Service业务层处理
 * 
 * @author ActActivityDistribution
 * @date 2020-11-29
 */
@Service
public class ActActivityDistributionServiceImpl implements IActActivityDistributionService 
{
    @Autowired
    private ActActivityDistributionMapper actActivityDistributionMapper;


    @Override
    public Map<String, Object> getActActivityDistribution(Map<String, Object> map) throws Exception {
        List<Map<String, Object>> getActActivityDistribution = actActivityDistributionMapper.getActActivityDistribution(map);
        if(!Utils.IsNull(getActActivityDistribution)&&getActActivityDistribution.size()>0){
            return getActActivityDistribution.get(0);
        }
        return null;
    }

    /**
     * 查询活动分润对象
     * 
     * @param id 活动分润对象ID
     * @return 活动分润对象
     */
    @Override
    public ActActivityDistribution selectActActivityDistributionById(Long id)
    {
        return actActivityDistributionMapper.selectActActivityDistributionById(id);
    }

    /**
     * 查询活动分润对象列表
     * 
     * @param actActivityDistribution 活动分润对象
     * @return 活动分润对象
     */
    @Override
    public List<ActActivityDistribution> selectActActivityDistributionList(ActActivityDistribution actActivityDistribution)
    {
        return actActivityDistributionMapper.selectActActivityDistributionList(actActivityDistribution);
    }

    /**
     * 新增活动分润对象
     * 
     * @param actActivityDistribution 活动分润对象
     * @return 结果
     */
    @Override
    public int insertActActivityDistribution(ActActivityDistribution actActivityDistribution)
    {
        return actActivityDistributionMapper.insertActActivityDistribution(actActivityDistribution);
    }

    /**
     * 修改活动分润对象
     * 
     * @param actActivityDistribution 活动分润对象
     * @return 结果
     */
    @Override
    public int updateActActivityDistribution(ActActivityDistribution actActivityDistribution)
    {
        return actActivityDistributionMapper.updateActActivityDistribution(actActivityDistribution);
    }

    /**
     * 删除活动分润对象对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteActActivityDistributionByIds(String ids)
    {
        return actActivityDistributionMapper.deleteActActivityDistributionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除活动分润对象信息
     * 
     * @param id 活动分润对象ID
     * @return 结果
     */
    @Override
    public int deleteActActivityDistributionById(Long id)
    {
        return actActivityDistributionMapper.deleteActActivityDistributionById(id);
    }

    @Override
    public int getNextval()
    {
        return actActivityDistributionMapper.getNextval();
    }

    @Override
    public boolean addActActivityDistribution(Map<String, Object> map) throws Exception {
        return actActivityDistributionMapper.addActActivityDistribution(map)>0;
    }

    @Override
    public boolean updateActActivityDistributions(Map<String, Object> map) throws Exception {
        return actActivityDistributionMapper.updateActActivityDistributions(map)>0;
    }
}
